package cl.solidit.geomanagement.web.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import cl.solidit.geomanagement.persistance.PersonaDAO;
import cl.solidit.geomanagement.persistance.PropiedadDAO;

@Service
public class DataUploadService {
	

	@Autowired
	private PersonaDAO personaDAO;
	@Autowired
	private PropiedadDAO propiedadDAO;

	@Async
	public void loadPersonas(Long upload, String[] registros) {
		for (String registro : registros) {
			String[] datos = registro.split(";");
			personaDAO.loadPersona(upload, datos);
		}
	}
	@Async
	public void loadPropiedades(Long upload, String[] registros) {
		for (String registro : registros) {
			String[] datos = registro.split(";");
			propiedadDAO.loadPropiedad(upload, datos);
		}
	}

	

}
